#!/bin/sh

LUA=lua

echo "Starting server"
$LUA server.lua &
pid=$!
trap "kill $pid > /dev/null 2> /dev/null" 0

for((i=0;i<10;++i));do if test -r ref.ior;then break;else sleep 1;fi;done
for((i=0;i<10;++i));do if test -r ref.ludo;then break;else sleep 1;fi;done

echo "Starting CORBA client"
$LUA ../hello/client.lua

echo "Starting LuDO client"
$LUA ../hello_simple/client.lua

echo "Demo finished."
rm -f ref.ior ref.ludo
